﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class forget : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["usr"] != null)
        {
            Response.Write("<script>alert('您已经登陆，退出后重试');location.href='" + Request.UrlReferrer.ToString() + "';</script>");
        }

    }

    protected void sumbit_Click(object sender, EventArgs e)
    {
       if(func.ishave(txtuser.Text.Trim()))
        {
           if(func.istrue(txtuser.Text.Trim(),txtph.Text.Trim(),txtema.Text.Trim()))
            {
                string t = func.getcode(txtuser.Text.Trim(), txtph.Text.Trim(), txtema.Text.Trim());
                Response.Write("<script>alert('密码为"+t+ "请牢记密码');location.href='login.aspx';</script>");
            }
           else
            {
                Response.Write("<script>alert('提供数据不正确请稍后再试')</script>");
            }
            
        }
       else
        {
            Response.Write("<script>alert('该用户不存在')</script>");

        }
    }
}